package com.factory._16state;

/**
 * 状态的环境，用于执行状态对应的行为。
 * @author Qinye
 * @date 2023/8/13 17:56
 */
public class WorkFlow {
    private FlowTask flowTask;

    public WorkFlow(FlowTask flowTask) {
        this.flowTask = flowTask;
    }

    public void changeFlowTask(FlowTask task) {
        System.out.println(this.flowTask.getClass().getName()+" end , current flow: "+ task.getClass().getName());
        this.flowTask = task;
    }
    public void next(){
        this.flowTask.next(this);
    }
    public void back(){
        this.flowTask.back(this);
    }
}
